vui.Namespace('View.userList.Page', function () {
    var _this = this;
    _this.Init = function () {
        vui.Page.Init({
            componentList: ['antdComponents', 'HeaderBox', 'LeftMenu', 'TableList', {
                id: 'userList',
                isPage: true,
                baseDir:'/sys/'
            }],
            fn: function () {
                _bindData();
                _bindEvent();
            }
        })


        //console.log(UserMenu);
    };
    //初始化本地数据
    var _bindData = function () {

        var pageData = {
            table1: {
                title: '用户列表',
                columns: [{
                    title: '',
                    dataIndex: 'Area',
                    key: 'Area',
                    align: 'left',
                    width: 300,
                }, {
                    title: '报备',
                    dataIndex: 'baobeiCount',
                    key: 'baobeiCount',
                    width: 100,
                    align: 'center',
                }, {
                    title: '到访',
                    dataIndex: 'daofangCount',
                    key: 'daofangCount',
                    width: 80,
                    align: 'center',
                }, {
                    title: '认筹',
                    dataIndex: 'BookingCount',
                    key: 'BookingCount',
                    width: 80,
                    align: 'center',
                }, {
                    title: '认购套数',
                    dataIndex: 'OrderCount',
                    key: 'OrderCount',
                    width: 80,
                    align: 'center',
                }, {
                    title: '认购金额(元)',
                    dataIndex: 'OrderAmount',
                    key: 'OrderAmount',
                    align: 'right',
                }, {
                    title: '签约套数',
                    dataIndex: 'ContractCount',
                    key: 'ContractCount',
                    align: 'center',
                    width: 80,
                }, {
                    title: '签约金额(元)',
                    dataIndex: 'ContractAmount',
                    key: 'ContractAmount',
                    align: 'right',
                }, {
                    title: '退筹',
                    dataIndex: 'BookingCancelCount',
                    key: 'BookingCancelCount',
                    width: 80,
                    align: 'center',
                }, {
                    fixed: 'right',
                    title: '退房',
                    dataIndex: 'OrderCancelCount',
                    key: 'OrderCancelCount',
                    width: 80,
                    align: 'center',
                }],
                dataSource: [
                    {
                        "Area": "地产板块",
                        "City": "",
                        "project": "",
                        "baobeiCount": "1",
                        "daofangCount": "1",
                        "BookingCount": "0",
                        "BookingCancelCount": "0",
                        "OrderCount": "0",
                        "OrderAmount": "0.00",
                        "OrderCancelCount": "0",
                        "ContractCount": "0",
                        "ContractAmount": "0.00",
                        "haschildren": "BFD658A5-F645-468C-A11C-FB1689C1A166",
                        "level": "5",
                        "key": "BFD658A5-F645-468C-A11C-FB1689C1A166",
                    }, 
                    {
                        "Area": "深圳地产",
                        "Column1": "",
                        "project": "",
                        "baobeiCount": "0",
                        "daofangCount": "0",
                        "BookingCount": "0",
                        "BookingCancelCount": "0",
                        "OrderCount": "0",
                        "OrderAmount": "0.00",
                        "OrderCancelCount": "0",
                        "ContractCount": "0",
                        "ContractAmount": "0.00",
                        "haschildren": "8E6A158D-B466-415F-8136-DF71CC789422",
                        "level": "7",
                        "key": "8E6A158D-B466-415F-8136-DF71CC789422",
                    }, 
                    {
                        "Area": "西部地产",
                        "Column1": "",
                        "project": "",
                        "baobeiCount": "1",
                        "daofangCount": "1",
                        "BookingCount": "0",
                        "BookingCancelCount": "0",
                        "OrderCount": "0",
                        "OrderAmount": "0.00",
                        "OrderCancelCount": "0",
                        "ContractCount": "0",
                        "ContractAmount": "0.00",
                        "haschildren": "456A7A63-1550-47BA-BF12-2B16FA243E35",
                        "level": "7",
                        "key": "456A7A63-1550-47BA-BF12-2B16FA243E35",
                    }, 
                    {
                        "Area": "福州区域",
                        "City": "",
                        "project": "",
                        "baobeiCount": "0",
                        "daofangCount": "0",
                        "BookingCount": "0",
                        "BookingCancelCount": "0",
                        "OrderCount": "0",
                        "OrderAmount": "0.00",
                        "OrderCancelCount": "0",
                        "ContractCount": "0",
                        "ContractAmount": "0.00",
                        "haschildren": "6A329480-ED39-4CA9-BBF8-737281F15A5A",
                        "level": "6",
                        "key": "6A329480-ED39-4CA9-BBF8-737281F15A5A",
                    }, 
                    {
                        "Area": "上海区域",
                        "City": "",
                        "project": "",
                        "baobeiCount": "0",
                        "daofangCount": "0",
                        "BookingCount": "0",
                        "BookingCancelCount": "0",
                        "OrderCount": "0",
                        "OrderAmount": "0.00",
                        "OrderCancelCount": "0",
                        "ContractCount": "0",
                        "ContractAmount": "0.00",
                        "haschildren": "77C03184-D6C3-405F-8C6B-29D53791E2B4",
                        "level": "6",
                        "key": "77C03184-D6C3-405F-8C6B-29D53791E2B4",
                    }, 
                    {
                        "Area": "北京区域",
                        "City": "",
                        "project": "",
                        "baobeiCount": "0",
                        "daofangCount": "0",
                        "BookingCount": "0",
                        "BookingCancelCount": "0",
                        "OrderCount": "0",
                        "OrderAmount": "0.00",
                        "OrderCancelCount": "0",
                        "ContractCount": "0",
                        "ContractAmount": "0.00",
                        "haschildren": "B954F1F2-7B3C-49EF-95A2-428842860EFE",
                        "level": "6",
                        "key": "B954F1F2-7B3C-49EF-95A2-428842860EFE",
                    }, 
                    {
                        "Area": "福州商业地产",
                        "City": "",
                        "project": "",
                        "baobeiCount": "0",
                        "daofangCount": "0",
                        "BookingCount": "0",
                        "BookingCancelCount": "0",
                        "OrderCount": "0",
                        "OrderAmount": "0.00",
                        "OrderCancelCount": "0",
                        "ContractCount": "0",
                        "ContractAmount": "0.00",
                        "haschildren": "E86188D8-714F-4212-816F-BA286B11F488",
                        "level": "6",
                        "key": "E86188D8-714F-4212-816F-BA286B11F488",
                    }
                ],
                loading: true,
            },
        };
        vui.Page.Render({
            id: ".app",
            componentID: "Page",
            isPage: true,
            template: '<Page />',
            data: pageData,
        });
        vui.Component.Page.setState(pageData);
        vui.Catch = {
            callBack: function (page, pageSize) {

                data.PageIndex = page;
                data.PageSize = pageSize;

                vui.Data.getFuncData({
                    funcid: "CustomerList_Select",
                    param: data,
                    success: function (res) {
                        pageData.table1.dataSource = res.data.List ? res.data.List : [];
                        pageData.table1.pagination.defaultCurrent = page;
                        pageData.table1.pagination.total = res.data.AllCount ? res.data.AllCount : 0;
                        pageData.table1.pagination.defaultPageSize = pageSize;
                        vui.Component.Page.setState(pageData);

                    }
                });
            },
            clear:function(){
                vui.Component.Page.setState(pageData);
            },
            checkChange:function(checked){
                pageData.table1.loading = checked;
                vui.Component.Page.setState(pageData);
            }
        }

    };
    var _bindEvent = function(){

    }
});
